use crate::{ui::UiOutput, math::Vector2u};

use self::rhi::Rhi;

use super::resource::resource_system::AliceResource;

pub mod render_pipeline;

pub mod rhi;

pub mod loader;

pub mod main_camera_pass;

pub mod pass;

pub mod canvas_pipeline;

pub mod render_system;

pub mod render_target;

pub mod ui_pipeline;


#[derive(Clone)]
pub struct RenderPipelineInitInfo {
    pub rhi: Rhi,
    pub resource:AliceResource
}




#[derive(Debug,PartialEq, Eq, PartialOrd, Ord,Clone, Copy)]
pub enum Order {
    // BeforeD3 = 0,
    // AfterD3,
    BeforeD2,
    AfterD2,
}

pub struct ScreenDescriptorInfo {
    pub view_port_size:Vector2u,
    pub scale_factor: f32
}


pub trait CustomRenderPipeline: std::any::Any {
    /// Order 为自定义管线的执行时机
    /// bool 为是否为自定义输出管线 如果为 true 会接管引擎默认的输出管线
    fn attach(&mut self , rhi:Rhi) -> Order;


    /// 如果为自定义的输出管线 , 会接受一组其他管线的渲染纹理 自行处理
    fn draw(&mut self,view:&wgpu::TextureView , ui_output:Option<&UiOutput> ,screen_desc:&ScreenDescriptorInfo);

    fn get_pipeline_name(&self) -> &'static str;


    fn as_any(&self) -> &dyn std::any::Any;
    fn as_any_mut(&mut self) -> &mut dyn std::any::Any;

    
}



